Tangible Software Solutions

Java to VB Converter Help


Contents

  1. Folder Conversion
  2. File & Snippet Conversion
  3. Code Formatting Options
  4. Conversion Message Options
  5. Custom String Replacements
  6. Type & Member Replacements
  7. Diagnostic Options
  8. File Encoding Options
  9. Additions & Omissions
  10. Java Class Library to .NET Options
  11. Omit Types from Conversion
  12. Accessor & Mutator Method Conversion
  13. Miscellaneous Options


Folder Conversion

The Folder Converter tab allows you to convert all Java code within a folder. Once the files are converted, you can then view Java to VB Converter comments, compare converted code files to original code files, and view the converted code folder.

The Conversion History listview displays previously converted sources and allows you to view remaining Java to VB Converter comments and view the converted code folder.


File & Snippet Conversion

The File & Snippet Converter tab allows you to convert Java code snippets or files. From the left side textbox, you can type or paste code snippets, insert files, or view Java to VB Converter sample snippets. Once a file or snippet is converted, you can select and copy the results, save the results to a file, or search the results.


Code Formatting Options


Conversion Message Options

On this options dialog, you can customize the comment prefixes that the converter uses for messages and also toggle the messages that Java to VB Converter displays on or off.

You can easily set all or none to display via the 'Select All' and 'Select None' buttons.


Custom String Replacements

Java to VB Converter allows you to specify your own custom replacements in the converted code. This can be useful for cases where you wish to specify a replacement for a Java library data type that isn't handle by Java to VB Converter.

For each replacement string you can specify the regex option, when to perform the replacement (pre or post conversion), whether or not to match case, whether to match whole words only, and whether comments or string literals should be modified. The whole words and string literals options do not apply if the regex option is selected.

To span mulitple lines, either paste directly into the 'Find' and 'Replacement' textboxes, or use the escaped characters: \r\n\t.

The "Active" checkbox can be unchecked if you wish to temporarily bypass the replacement.

Replacements are made in the order that they appear on the options dialog. For example, the second replacement is made to each line of code after the first replacement has already been made. To change the order of replacements, use the 'Up' and 'Down' buttons.

For an example of the regex option, you could do a custom replacement of "Foo(x)" with "Bar(x)", where "x" is any argument, by specifying the "Find" field as "Foo(([\sa-zA-Z_$]*))" and the "Replace" field as "Bar$1". Note that there are differences in various regex engines - the regex engine used by the converter is .NET System.Text.RegularExpressions.Regex.


Type & Member Replacements

Java to VB Converter allows you to specify your own custom type and member replacements in the converted code. This can be useful for cases where you wish to specify replacements for Java library member calls of a specific type that are not handled by Java to VB Converter.

For each external type, you can specify an optional type replacement and multiple member replacements. For types, you can specify template/generic types, which may include '?' as a wildcard type. A wildcard in the replacement type must have a matching wildcard in the same position in the original type.

e.g., the following will replace all references to type 'Foo' having one 'int' type parameter with 'Bar', having no type parameters:
original type: Foo<int>
replacement type: Bar

e.g., the following will replace all references to type 'Foo' having one type parameter of any type with 'Bar', having the same type parameter:
original type: Foo<?>
replacement type: Bar(Of ?)

For each member replacement, you specify the original member name, whether the member is static or not, and whether the member is a method or a field. You also specify the number of arguments you expect.

For the replacement member, you specify whether the replacement is static or not, and whether the replacement is a method or a field. You also specify the new list of arguments and can add literal arguments. For replacement of static methods with instance members, you also specify the argument position which corresponds to the object instance for the new instance member. For replacement of instance members with static members, you specify the new class name used to call the static member (for static methods, you also specify the position in the argument list to insert the previous instance qualifier, using the string "instance" (quotes not included) at the appropriate position in the "new argument list" field). For example, if you want to replace all instance calls to the 'Foo' type method 'Bar' where you want the instance qualifier to be the new first argument, you would specify "instance, a1" (quotes not included) for the "new argument list" field, assuming that there was one argument in the original method calls.


Diagnostic Options

These options are intended to provide information to Tangible Software Solutions if a conversion is taking longer than expected. 'Record processing by file' instructs the converter to make a record of the files processed and the time taken for each process. 'Record the last 100 lines of code parsed before cancelling conversion' instructs the converter to make a record of the most recent lines parsed before you cancelled the conversion.


File Encoding Options

The converter detects input file encoding from the byte order mark (BOM), but if the BOM is missing the converter assumes by default that the file encoding is UTF-8. You can use this option to specify a different default encoding to use in the absence of a BOM. Output is written in the same encoding as the encoding detected for the original file, or your default encoding option if the original coding was not detected via the BOM. For UTF-8, you can choose whether or not to include the BOM for the output - this is normally used in Windows environments.


Additions & Omissions


Java Class Library to .NET Options


Omit Types from Conversion

Any type entered here will be omitted from most conversion logic. You would normally enter library type names here to prevent the default conversion of objects of those types.


Accessor & Mutator Method Conversion

If you choose this option, Java parameterless methods starting with get or is and single-parameter methods starting with set will be converted to VB properties if the original method name followed the common Java lower camel case naming convention. If you select 'Convert to automatic properties if possible', then automatic properties are used provided that the 'get' method is a single line which returns a private backing field, and the 'set' method is a single line which sets the same backing field.


Miscellaneous Options


Copyright © Tangible Software Solutions, Inc.